<?php

    $oper = $_POST["oper"];

    $id = $_POST["id"];


    include'db.php';
    $db = new db();

    if($oper == "add"){
        $user = $_POST["user"];
        $message = $_POST["message"];
        $result = $db->query("INSERT INTO user_message1 (user,message) VALUES ('$user','$message')");
    }else if($oper == "edit"){
        $user = $_POST["user"];
        $message = $_POST["message"];
        $result = $db->query("UPDATE user_message1 SET user='$user',message='$message' WHERE id=$id");
    }else if($oper == "del"){
        $result = $db->query("DELETE FROM user_message1 WHERE id=$id");
    }
?>